"""
老师接口
"""
from db import modols


def list_course(teacher_name):
    teacher_obj = modols.Teacher.select(teacher_name)
    return teacher_obj.check_course()


def select_course_interface(course_name, teacher_name):
    teacher_obj = modols.Teacher.select(teacher_name)
    if course_name in teacher_obj.course_list:
        return False, '该课程以存在！'
    teacher_obj.select_course(course_name)
    return True, f'{course_name}课程选择成功'


def list_student_interface(course_name, teacher_name):
    teacher_obj = modols.Teacher.select(teacher_name)
    student_list = teacher_obj.get_student(course_name)
    return student_list

def manage_student_interface(student_name,course_name,score,teacher_name):
    teacher_obj=modols.Teacher.select(teacher_name)
    student_obj=modols.Student.select(student_name)
    teacher_obj.manage_student(student_obj,course_name,score)

